{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "root:x:0:0:root:/root:/bin/bash\n",
      "bin:x:1:1:bin:/bin:/sbin/nologin\n",
      "daemon:x:2:2:daemon:/sbin:/sbin/nologin\n",
      "adm:x:3:4:adm:/var/adm:/sbin/nologin\n",
      "lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin\n",
      "sync:x:5:0:sync:/sbin:/bin/sync\n",
      "shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown\n",
      "halt:x:7:0:halt:/sbin:/sbin/halt\n",
      "mail:x:8:12:mail:/var/spool/mail:/sbin/nologin\n",
      "operator:x:11:0:operator:/root:/sbin/nologin\n",
      "games:x:12:100:games:/usr/games:/sbin/nologin\n",
      "ftp:x:14:50:FTP User:/var/lib/tuleap/ftp:/sbin/nologin\n",
      "nobody:x:99:99:Nobody:/:/sbin/nologin\n",
      "systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin\n",
      "dbus:x:81:81:System message bus:/:/sbin/nologin\n",
      "polkitd:x:999:997:User for polkitd:/:/sbin/nologin\n",
      "postfix:x:89:89::/var/spool/postfix:/sbin/nologin\n",
      "chrony:x:998:996::/var/lib/chrony:/sbin/nologin\n",
      "sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin\n",
      "ntp:x:38:38::/etc/ntp:/sbin/nologin\n",
      "tcpdump:x:72:72::/:/sbin/nologin\n",
      "nscd:x:28:28:NSCD Daemon:/:/sbin/nologin\n",
      "apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin\n",
      "tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin\n",
      "zabbix:x:997:995:Zabbix Monitoring System:/var/lib/zabbix:/sbin/nologin\n",
      "mysql:x:27:27:MariaDB Server:/var/lib/mysql:/sbin/nologin\n",
      "postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash\n",
      "pepa:x:1000:1000::/home/pepa:/bin/bash\n",
      "dbuser:x:1001:1001::/home/dbuser:/bin/bash\n",
      "mongod:x:996:994:mongod:/var/lib/mongo:/bin/false\n",
      "jenkins:x:995:993:Jenkins Automation Server:/var/lib/jenkins:/bin/false\n",
      "redis:x:994:992:Redis Database Server:/var/lib/redis:/sbin/nologin\n",
      "openproject:x:993:991::/home/openproject:/bin/bash\n",
      "nginx:x:992:990:Nginx web server:/var/lib/nginx:/sbin/nologin\n",
      "gitolite3:x:991:989:git repository hosting:/var/lib/gitolite3:/bin/sh\n",
      "codendiadm:x:990:987:Tuleap user:/var/lib/tuleap:/bin/bash\n",
      "ftpadmin:x:989:985:FTP Administrator:/var/lib/tuleap/ftp:/bin/bash\n",
      "dummy:x:988:986:Dummy Tuleap User:/var/lib/tuleap/dumps:/bin/bash\n",
      "gitolite:x:1002:984:Git:/var/lib/gitolite:/bin/bash\n"
     ]
    }
   ],
   "source": [
    "# AWK \n",
    "    awk其名称得自于它的创始人 Alfred Aho 、Peter Weinberger 和 Brian Kernighan 姓氏的首个字母。实际上 AWK 的确拥有自己的语言： AWK 程序设计语言 ， 三位创建者已将它正式定义为“样式扫描和处理语言\n",
    "\n",
    "awk(报告生成器),grep(文本过滤器),sed(流编辑器)\n",
    "# 参考：https://yq.aliyun.com/articles/623833\n",
    "https://blog.csdn.net/dddxxy/article/details/91170251\n",
    "https://blog.saymagic.cn/2016/04/24/awk-common-skills.html\n",
    "https://www.cnblogs.com/clsn/p/8419374.html"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/root//root//root//root//root/\n",
      "WSGI是Python在处理HTTP请求时，规定的一种处理方式。如一个HTTP Request过来了，那么就有一个相应的处理函数来进行处理和返回结果。WSGI就是规定这个处理函数的参数长啥样的，它的返回结果是长啥样的？至于该处理函数的名子和处理逻辑是啥样的，那无所谓。简单而言，WSGI就是规定了处理函数的输入和输出格式。\n"
     ]
    }
   ],
   "source": [
    "# 输出完整文档\n",
    "awk '$0' sed_used.txt\n",
    "awk '{print $0}' /etc/passwd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2\n"
     ]
    }
   ],
   "source": [
    "awk 'END{ print FNR }' sed_used.txt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Bash",
   "language": "bash",
   "name": "bash"
  },
  "language_info": {
   "codemirror_mode": "shell",
   "file_extension": ".sh",
   "mimetype": "text/x-sh",
   "name": "bash"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
